﻿using Pattern14访问者模式.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pattern14访问者模式.Models
{
    /// <summary>
    /// 结构对象角色
    /// </summary>
    public class Home
    {
        private readonly List<IAnimal> animals = new List<IAnimal>();

        public void  Add(IAnimal animal)
        {
            animals.Add(animal);
        }

        public void Start(IPerson person)
        {
            foreach (var animal in animals)
            {
                animal.Accept(person);
            }
        }
    }
}
